<template>
  <view class="address_container">
    <view class="item">
      <text>收货人</text>
      <text class="text">{{nickName}}</text>
    </view>
    <view class="item">
      <text>手机号</text>
      <text class="text">{{mobile}}</text>
    </view>
    <view class="item">
      <text>收货地址</text>
      <text class="text">{{detail}}</text>
    </view>
  </view>
</template>

<script>
import { getPurchaserInfo } from '@/api/setting/index.js'
import jwtDecode from 'jwt-decode'


export default {
  data () {
    return {
      nickName: '',
      mobile: '',
      detail: '',
    }
  },
  onShow () {
    let a = JSON.parse(jwtDecode(uni.getStorageSync('token')).userContext.replace('\\', ''))
    this.nickName = a.nickName
    getPurchaserInfo().then(res => {
      if (res.code === 200) {
        this.name = res.data.name
        this.mobile = res.data.mobile
        this.detail = res.data.detail
      }
    })
  },
}
</script>

<style lang="scss" scoped>
.address_container {
  background: #f9f9f9;
  max-height: 100vh;
  padding-top: 20rpx;
}
.item {
  border-bottom: 1px solid #f9f9f9;
  padding: 40rpx 50rpx;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 28rpx;
  background: #fff;
  text:first-child {
    white-space: nowrap;
  }
  .text {
    margin-left: 21%;
    text-align: end;
  }
}
</style>
